package ua.com.infopulse.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

/**
 * @author Andrew.Nazymko
 */
public class DBGetter {
    private static DBHelper _helper = null;
    private static SQLiteDatabase writableDatabase;
    private static DataTrackManager _DTM = null;

    public DBGetter(Context context) {
        if (_helper == null) {
            _helper = new DBHelper(context);
        }
        writableDatabase = _helper.getWritableDatabase();

    }

    public static DataTrackManager getDTM() {
        if (_DTM == null) {
            _DTM = new DataTrackManager(getWritableDatabase());
        }
        return _DTM;
    }

    public static DBHelper get_helper() {
        return _helper;
    }

    public static void set_helper(DBHelper _helper) {
        DBGetter._helper = _helper;
    }

    public static SQLiteDatabase getWritableDatabase() {
        return writableDatabase;
    }

    public static void setWritableDatabase(SQLiteDatabase writableDatabase) {
        DBGetter.writableDatabase = writableDatabase;
    }
}
